/**
 * @file    WebStream.cpp
 * @brief   
 * @date    2005-03-15 15:55:23
 * @author  GengYong (gengyong@gmail.com)
 *
 */

#include "WebStream.h"
#include <cassert>

using namespace xessage_private;

WebStream::WebStream(WebWindowImpl * app):m_appImpl(app), m_refCount(1)
{
	return;
}

WebStream::~WebStream()
{
	return;
}

HRESULT	STDMETHODCALLTYPE WebStream::QueryInterface(REFIID riid, void ** ppvObject)
{
	if (ppvObject == NULL) return E_POINTER;

	if ((riid == IID_IUnknown) || (riid == IID_IStream))
	{
		this->AddRef();
		*ppvObject = this;
	}
	else
	{
		*ppvObject = 0;
		return E_NOINTERFACE;
	}
	return S_OK;
}

ULONG	STDMETHODCALLTYPE WebStream::AddRef()
{
	return InterlockedIncrement(&m_refCount);
}

ULONG	STDMETHODCALLTYPE WebStream::Release()
{
	LONG result = InterlockedDecrement(&m_refCount);
	assert(result >= 0);
	if (result == 0)
	{
		delete this;
	}
	return (ULONG)(result);
}

HRESULT STDMETHODCALLTYPE WebStream::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::Write(const void *pv, ULONG cb, ULONG *pcbWritten)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::Seek(LARGE_INTEGER dlibMove, 
										  DWORD dwOrigin,
										  ULARGE_INTEGER *plibNewPosition)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::SetSize(ULARGE_INTEGER libNewSize)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::CopyTo(IStream *pstm,
											ULARGE_INTEGER cb,
											ULARGE_INTEGER *pcbRead,
											ULARGE_INTEGER *pcbWritten)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::Commit(DWORD grfCommitFlags)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::Revert(VOID)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::LockRegion(ULARGE_INTEGER libOffset,
												ULARGE_INTEGER cb,
												DWORD dwLockType)
{
	return E_NOTIMPL;;
}


HRESULT STDMETHODCALLTYPE WebStream::UnlockRegion(ULARGE_INTEGER libOffset,
												  ULARGE_INTEGER cb,
												  DWORD dwLockType)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::Stat(STATSTG *pstatstg, DWORD grfStatFlag)
{
	return E_NOTIMPL;;
}

HRESULT STDMETHODCALLTYPE WebStream::Clone(IStream **ppstm)
{
	return E_NOTIMPL;;
}
